﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCCommon;
using BCCommon.TMS.FreightEnums;
using BCCommon.TMS.Order;
using BCDto.Sim.Admin.Admin;
using BCDto.TMS.FreightConfiguration;

namespace BCService.TMS.FreightConfigurationService
{
    /// <summary>
    /// 运费配置业务接口
    /// </summary>
    public interface IFreightConfigurationService
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="editer">编辑人</param>
        /// <param name="dto">参数模型</param>
        /// <returns></returns>
        int InsertAsync(string editer, FreightConfigurationRequestDto dto);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="isSystemAccount">是否超级管理员</param>
        /// <param name="editer">编辑人</param>
        /// <param name="freightConfigurationId">运费配置id</param>
        /// <param name="dto">参数模型</param>
        /// <returns></returns>
        int UpdateAsync(bool isSystemAccount, string editer, int freightConfigurationId, FreightConfigurationRequestDto dto);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="freightConfigurationId">运费配置id</param>
        /// <returns></returns>
        int DeleteAsync(int freightConfigurationId);

        /// <summary>
        /// 通过运费配置id获取运费配置信息
        /// </summary>
        /// <param name="freightConfigurationId">运费配置id</param>
        /// <returns></returns>
        FreightConfigurationDto GetByIdAsync(int freightConfigurationId);

        /// <summary>
        /// 条件分页查询
        /// </summary>
        /// <param name="admin">管理员信息</param>
        /// <param name="dto">列表请求参数</param>
        /// <returns></returns>
        PageableList<FreightConfigurationDto> GetAllAsync(AdminDto admin, FreightConfigurationListRequestDto dto);


        /// <summary>
        /// 返回指定的运费配置
        /// </summary>
        /// <param name="vehicleTypeId">车型ID</param>
        /// <param name="vehicleCategoryReferenceId">车辆分类ID</param>
        /// <param name="ProvinceCode">省编码</param>
        /// <param name="CityCode">市编码</param>
        /// <param name="CountyCode">区县编码</param>
        /// <param name="sourceType">订单来源</param>
        /// <param name="freightType">物流类型</param>
        /// <returns></returns>
        FreightConfigurationDto Get(int vehicleTypeId, int vehicleCategoryReferenceId, string ProvinceCode, string CityCode, string CountyCode, OrderSourceType? sourceType, FreightType? freightType);

        /// <summary>
        /// 初始化修复缺失的区县运费配置
        /// </summary>
        /// <returns></returns>
        bool InitRepair();

        /// <summary>
        /// 获取运费配置信息列表
        /// </summary>
        /// <param name="admin">管理员信息</param>
        /// <param name="provinceCode">省编码</param>
        /// <param name="cityCode">市编码</param>
        /// <param name="countyCode">区/县编码</param>
        /// <param name="vehicleTypeId">车辆类型id</param>
        /// <param name="sourceType">订单来源</param>
        /// <param name="freightType">物流类型</param>
        /// <returns></returns>
        IEnumerable<FreightConfigurationDto> GetList(AdminDto admin, string provinceCode, string cityCode, string countyCode, int? vehicleTypeId, OrderSourceType? sourceType, FreightType? freightType);
    }
}